package com.jsmile.cloud.accountcenter.api.feign;

import javax.validation.Valid;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jsmile.cloud.accountcenter.api.constants.AccountConstants;
import com.jsmile.cloud.accountcenter.api.req.address.ReqAddressDetial;
import com.jsmile.cloud.accountcenter.api.req.address.ReqAddressPageQuery;
import com.jsmile.cloud.accountcenter.api.req.address.ReqAddressSave;
import com.jsmile.cloud.accountcenter.api.req.address.ReqAddressUpdate;
import com.jsmile.cloud.accountcenter.api.res.ResUserAddress;
import com.jsmile.mall.api.JSmileResult;
import com.jsmile.mall.api.to.BaseTo;
import com.jsmile.mall.api.to.JsmilePage;

@FeignClient(value = AccountConstants.APPLICATION_NAME, contextId = "address")
public interface AddressServiceApi {

    // TODO 获取地址
    @RequestMapping(value = "/feign/address/getUserAddress", method = RequestMethod.POST)
    JSmileResult<ResUserAddress> getUserAddress(@RequestBody @Valid ReqAddressDetial req);

    // TODO 添加地址
    @RequestMapping(value = "/feign/address/addUserAddress", method = RequestMethod.POST)
    JSmileResult<Boolean> addUserAddress(@RequestBody @Valid ReqAddressSave reqAddressSave);

    // TODO 更新地址
    @RequestMapping(value = "/feign/address/changeUserAddress", method = RequestMethod.POST)
    JSmileResult<Boolean> changeUserAddress(@RequestBody @Valid ReqAddressUpdate req);

    // TODO 获取默认地址
    @RequestMapping(value = "/feign/address/getDefaultUserAddress", method = RequestMethod.POST)
    JSmileResult<ResUserAddress> getDefaultUserAddress(@RequestBody @Valid BaseTo baseTo);

    // TODO 删除地址
    @RequestMapping(value = "/feign/address/deleteUserAddress", method = RequestMethod.POST)
    JSmileResult<Boolean> deleteUserAddress(@RequestBody @Valid ReqAddressDetial reqAddressDelete);

    // TODO 获取地址列表
    @RequestMapping(value = "/feign/address/getUserAddressPageList", method = RequestMethod.POST)
    JSmileResult<JsmilePage<ResUserAddress>> getUserAddressPageList(@RequestBody @Valid ReqAddressPageQuery reqAddressPageQuery);
}
